package gov.dhs.cis.soa.data;

import gov.dhs.cis.soa.Constants;
import gov.dhs.cis.soa.Utils;
import gov.dhs.cis.soa.Constants.EntityType;

public class DataClass extends AbstractSOAData {
	public static final String STEREO_TYPE = "Data Class";

	public int id;
	public String ename;
	public String cname;
	public String wipt;
	public transient String defination;
	public transient String comments;
	public String used;
	public String release;
	public String operations;
	public String application;
	public String integrationCfg;
	public Description desc;
	
	@Override
	public String toString() {
		return "DataClass [id=" + id + ", ename = " + ename + ", cname=" + cname + "]";
	}
	
	@Override
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		DataClass other = (DataClass) obj;
		if (id == other.id && cname.equalsIgnoreCase(other.cname))
			return true;
		return false;
	}	

	public void createDescription() {
		StringBuffer txt = new StringBuffer();
		if(Utils.isEmpty(defination))
			defination = "";
		txt.append(Constants.NL+"Defination = " + defination);
		if(Utils.isEmpty(comments))
			comments = "";
		txt.append(Constants.NL+"Comments = " + comments);
		
		desc = Utils.prepareDescObj(txt.toString(), EntityType.DATA);
	}
	
//	public static String getUMLId(int entityId) {
//		return EntityType.DATA + "_" + entityId;
//	}
	
	@Override
	public long getId() {
		return id;
	}
	@Override
	public String getHashableId() {
		return cname;
	}

	@Override
	public EntityType getUMLType() {
		return EntityType.DATA;
	}
}
